📚 SAP Business One SDK Help

Business Partner - GetByKey Method Sample
See Also

Description

The following example shows how to retrieve a business partner record from the database. Use this sample as a basis to all business objects of master data type (not document type).
Dim RetVal As Long
Dim vBP As SAPbobsCOM.BusinessPartners
Set vBP = vCmp.GetBusinessObject(oBusinessPartners)

'Retrieve a record by its key from the database
RetVal = vBP.GetByKey("BP00234")

'Check errors
   If RetVal <> 0 Then
      vCmp.GetLastError ErrCode, ErrMsg
      MsgBox "Failed to Retrieve the record " & ErrCode & " " & ErrMsg
      Exit Sub
   End If